/**
 * Copyright (c) 2012, Camelot and/or its affiliates. All rights reserved.
 * Camelot PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 */
package com.camelot.ccr.global.util;

import java.util.ResourceBundle;

/**
 * <pre>
 * 读取配置文件工具类
 * </pre>
 * @author Fu Dawei
 * @version V0.1, 2014-1-15 上午11:10:53
 */
public abstract class ResourceUtil {
	
	/**
	 * 系统配置文件
	 */
	public static final String DEFAULT_SYS_CONFIG = "sysconfig";
	
	public static final String DEFAULT_CONFIG_PATH = "config/";
	
	/**
	 * <pre>
	 * 从系统默认配置文件中根据属性名读取属性
	 * </pre>
	 * @param propertyName 属性名
	 * @return 属性值
	 * @author Fu Dawei, 2014-1-15 上午11:20:03
	 */
	public static String getProperty(String propertyName){
		ResourceBundle res = ResourceBundle.getBundle(DEFAULT_CONFIG_PATH + DEFAULT_SYS_CONFIG);
		return res.getString(propertyName);
	}
	
	/**
	 * <pre>
	 * 从指定配置文件中根据属性名读取属性
	 * </pre>
	 * @param propertyName 属性名
	 * @return 属性值
	 * @author Fu Dawei, 2014-1-15 上午11:20:03
	 */
	public static String getProperty(String configFileName, String propertyName){
		ResourceBundle res = ResourceBundle.getBundle(DEFAULT_CONFIG_PATH + configFileName);
		return res.getString(propertyName);
	}
}
